home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / pbmpl91d.zip / PBMPLUS / MAN / LIBPBM.MAN < prev    next >
Text File  |  1993-01-08  |  5KB  |  208 lines

  1.  
  2.  
  3. libpbm(3)                  Unix Programmer's Manual                  libpbm(3)
  4.  
  5.  
  6. NAME
  7.      libpbm - functions to support portable bitmap programs
  8.  
  9. SYNOPSIS
  10.  
  11.      #include <pbm.h>
  12.      cc ... libpbm.a
  13.  
  14.  
  15. DESCRIPTION - PACKAGE-WIDE ROUTINES
  16.  
  17.      KEYWORD MATCHING
  18.  
  19.      int pm_keymatch( char* str, char* keyword, int minchars )
  20.  
  21.      Does a case-insensitive match of str  against  keyword.   str  can  be  a
  22.      leading sunstring of keyword, but at least minchars must be present.
  23.  
  24.      LOG BASE TWO
  25.  
  26.      int pm_maxvaltobits( int maxval )
  27.      int pm_bitstomaxval( int bits )
  28.  
  29.      Convert between a maxval and the minimum number of bits required to  hold
  30.      it.
  31.  
  32.      MESSAGES AND ERRORS
  33.  
  34.      void pm_message( char* fmt, ... )
  35.  
  36.      printf() style routine to write an informational message.
  37.  
  38.      void pm_error( char* fmt, ... )
  39.  
  40.      printf() style routine to write an error message and abort.
  41.  
  42.      void pm_usage( char* usage )
  43.  
  44.      Write a usage message.  The string should indicate what arguments are  to
  45.      be provided to the program.
  46.  
  47.      GENERIC FILE MANAGEMENT
  48.  
  49.      FILE* pm_openr( char* name )
  50.  
  51.      Open the given file for reading,  with  appropriate  error  checking.   A
  52.      filename of "-" is taken as equivalent to stdin.
  53.  
  54.      FILE* pm_openw( char* name )
  55.              -
  56.  
  57.      Open the given file for writing, with appropriate error checking.
  58.  
  59.      void pm_close( FILE* fp )
  60.             -
  61.  
  62.      Close the file descriptor, with appropriate error checking.
  63.  
  64.  
  65.  
  66.                                                                              1
  67.  
  68.  
  69.  
  70. libpbm(3)                  Unix Programmer's Manual                  libpbm(3)
  71.  
  72.  
  73.      ENDIAN I/O
  74.  
  75.      int pm_readbigshort( FILE* in, short* sP )
  76.      int pm_writebigshort( FILE* out, short s )
  77.      int pm_readbiglong( FILE* in, long* lP )
  78.      int pm_writebiglong( FILE* out, long l )
  79.      int pm_readlittleshort( FILE* in, short* sP )
  80.      int pm_writelittleshort( FILE* out, short s )
  81.      int pm_readlittlelong( FILE* in, long* lP )
  82.      int pm_writelittlelong( FILE* out, long l )
  83.  
  84.      Routines to read and write short and long ints in either big- or  little-
  85.      endian byte order.
  86.  
  87. DESCRIPTION - PBM-SPECIFIC ROUTINES
  88.  
  89.      TYPES AND CONSTANTS
  90.  
  91.      typedef ... bit;
  92.      #define PBM_WHITE ...
  93.      #define PBM_BLACK ...
  94.  
  95.      each bit should contain only the values of PBM_WHITE or PBM_BLACK.
  96.                                                    -            -
  97.  
  98.      #define PBM_FORMAT ...
  99.      #define RPBM_FORMAT ...
  100.      #define PBM_TYPE PBM_FORMAT
  101.      #define PBM_FORMAT_TYPE(f) ...
  102.  
  103.      For distinguishing different file formats and types.
  104.  
  105.      INITIALIZATION
  106.  
  107.      void pbm_init( int* argcP, char* argv[] )
  108.  
  109.      All PBM programs must call this routine.
  110.  
  111.      MEMORY MANAGEMENT
  112.  
  113.      bit** pbm_allocarray( int cols, int rows )
  114.  
  115.      Allocate an array of bits.
  116.  
  117.      bit* pbm_allocrow( int cols )
  118.              -
  119.  
  120.      Allocate a row of the given number of bits.
  121.  
  122.      void pbm_freearray( bit** bits, int rows )
  123.              -
  124.  
  125.      Free the array  allocated  with  pbm_allocarray()  containing  the  given
  126.                                          -
  127.      number of rows.
  128.  
  129.      void pbm_freerow( bit* bitrow )
  130.  
  131.      Free a row of bits.
  132.  
  133.  
  134.  
  135.                                                                              2
  136.  
  137.  
  138.  
  139. libpbm(3)                  Unix Programmer's Manual                  libpbm(3)
  140.  
  141.  
  142.      READING FILES
  143.  
  144.      void pbm_readpbminit( FILE* fp, int* colsP, int* rowsP, int* formatP )
  145.  
  146.      Read the header from a PBM file, filling in the  rows,  cols  and  format
  147.      variables.
  148.  
  149.      void pbm_readpbmrow( FILE* fp, bit* bitrow, int cols, int format )
  150.              -
  151.  
  152.      Read a row of bits into the bitrow array.  Format and cols were filled in
  153.      by pbm_readpbminit().
  154.            -
  155.  
  156.      bit** pbm_readpbm( FILE* fp, int* colsP, int* rowsP )
  157.  
  158.      Read an entire bitmap file into memory, returning the allocated array and
  159.      filling   in  the  rows  and  cols  variables.   This  function  combines
  160.      pbm_readpbminit(), pbm_allocarray() and pbm_readpbmrow().
  161.         -                  -                    -
  162.  
  163.      WRITING FILES
  164.  
  165.      void pbm_writepbminit( FILE* fp, int cols, int rows, int forceplain )
  166.  
  167.      Write the header for a portable bitmap file.  The forceplain flag  forces
  168.      a plain-format file to be written, as opposed to a raw-format one.
  169.  
  170.      void pbm_writepbmrow( FILE* fp, bit* bitrow, int cols, int forceplain )
  171.              -
  172.  
  173.      Write a row from a portable bitmap.
  174.  
  175.      void pbm_writepbm(  FILE*  fp,  bit**  bits,  int  cols,  int  rows,  int
  176.              -
  177.      forceplain )
  178.  
  179.      Write the header and all data  for  a  portable  bitmap.   This  function
  180.      combines pbm_writepbminit() and pbm_writepbmrow().
  181.                  -                      -
  182.  
  183. SEE ALSO
  184.      libpgm(3), libppm(3), libpnm(3)
  185.  
  186. AUTHOR
  187.      Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.                                                                              3
  207.  
  208.